<?php defined('BASEPATH') or exit('No direct script access allowed');

class Module_Banner extends Module {

	public $version = 1.1;

	public function info()
	{
		return array(
			'name' => array(
				'es' => 'Escort banner es',
				'en' => 'Escort banner'
			),
			'description' => array(
				'es' => 'Escort banner Management',
				'en' => 'Escort banner Management'
				),
			'frontend' => TRUE,
			'backend' => TRUE,
			'skip_xss'	=> TRUE,
			'menu'		=> 'content',
			'sections' => array(
			    'banners' => array(
				    'name' => 'escort_banner_title',
				    'uri' => 'admin/banner',
				    'shortcuts' => array(
						array(
					 	   'name' => 'escort_banner_create_title',
						    'uri' => 'admin/banner/create',
						    'class' => 'add'
						),
					),
				),
				'ads-zones' => array(
				    'name' => 'escort_ads_zone_list_title',
				    'uri' => 'admin/banner/zones',
				    'shortcuts' => array(
						array(
						    'name' => 'escort_ads_zone_create_title',
						    'uri' => 'admin/banner/zones/create',
						    'class' => 'add'
						),
					),
				),
			),
		);
	}

	public function install()
	{
		$this->db->query("
			CREATE  TABLE IF NOT EXISTS ".$this->db->dbprefix('escort_ads_zones')." (
				`id` INT NOT NULL AUTO_INCREMENT ,
				
				  `zone` VARCHAR(45) NULL ,
				
				  `code` VARCHAR(45) NULL ,
				
				  `width` INT NULL ,
				
				  `height` INT NULL ,
				
				  `site_ids` VARCHAR(45) NULL ,
			  PRIMARY KEY (`id`)
			) ENGINE=InnoDB DEFAULT CHARSET=utf8
		");
		$this->db->query("
			CREATE  TABLE IF NOT EXISTS ".$this->db->dbprefix('escort_ads_banners')." (

			  `id` INT NOT NULL AUTO_INCREMENT ,

			  `user_added` VARCHAR(45) NULL ,
			
			  `permission_slug` VARCHAR(45) NULL ,
			
			  `site_ids` VARCHAR(45) NULL ,
			
			  `ads_zone_id` INT NULL ,
			
			  `banner_type` VARCHAR(45) NULL ,
			
			  `define_text` VARCHAR(255) NULL ,
			
			  `title` VARCHAR(255) NULL ,
			
			  `follow` INT NULL ,
			
			  `image` VARCHAR(255) NULL ,
			
			  `alt_image` VARCHAR(255) NULL ,
			
			  `link` VARCHAR(100) NULL ,
			
			  `width` INT NULL ,
			
			  `height` INT NULL ,
			
			  `script` TEXT NULL ,
			
			  `display_after_login` INT NULL ,
			
			  `updated_time` INT NULL ,
			
			  `active` INT NULL ,
			  PRIMARY KEY (`id`)
			) ENGINE=InnoDB DEFAULT CHARSET=utf8
		");
		return $this->db->query("
			CREATE  TABLE IF NOT EXISTS ".$this->db->dbprefix('escort_ads_banner_display_geolocations')." (
				`ads_banner_id` INT NOT NULL ,

				  `country_id` INT NULL ,
				
				  `region_id` INT NULL
			) ENGINE=InnoDB DEFAULT CHARSET=utf8
		");
	}

	public function uninstall()
	{
		return TRUE;
	}

	public function upgrade($old_version)
	{
		// Your Upgrade Logic
		return TRUE;
	}

	public function help()
	{
		// Return a string containing help info
		// You could include a file and return it here.
		return "This module has no inline docs as it does not have a back-end.";
	}
}
/* End of file details.php */